package org.springblade.modules.repair.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.repair.dto.MaintainPlanCalendarDataDownDTO;
import org.springblade.modules.repair.service.IElevatorService;
import org.springblade.modules.repair.vo.ElevatorPrincipalStatisticsVO;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.io.IOException;

/**
 * 在保电梯总览
 * Sprint40 WBM-2762 在保电梯总览 Controller
 * @author: Sharry
 * @createTime: 2023/6/27 20:56
 * @version: Version-1.0
 */
@RestController
@AllArgsConstructor
@RequestMapping("repair/elevator/statistics")
@Api(tags = "维保小程序 -【在保电梯总览】" , value = "repair/elevator/statistics")
public class ElevatorStatisticsController {

	private final IElevatorService elevatorService;

	/**
	 * @Author lsay,Sharry
	 * @Description {
	 *   电梯责任管理统计
	 *   copy from 管理端
	 * }
	 * @Date 10:22 2023/2/10
	 * @return statistics result
	 **/
	@GetMapping("/principal/count")
	@ApiOperation("维保小程序 -【在保电梯总览】")
	@ApiOperationSupport(order = 10)
	public R<ElevatorPrincipalStatisticsVO> elevatorPrincipalCount(){
		return R.data(elevatorService.selectElevatorOverview());
	}

	/**
	 * 下载未设置 Excel
	 * @param unsetType 未设置类型 1-未分配责任组，2-未设置责任人
	 * @return 下载链接
	 */
	@GetMapping("/down/excel")
	@ApiOperationSupport(order = 11)
	@ApiOperation("【在保电梯总览】-下载未设置信息Excel")
	public R<String> downUnsetExcel(Integer unsetType) {
		return R.data(elevatorService.downUnsetExcel(unsetType));
	}


}
